package xmu.crms.dao;

import xmu.crms.entity.Course;
import xmu.crms.exception.CourseNotFoundException;

import java.math.BigInteger;
import java.util.List;

/**
 * @author: heqi
 * @time: 2017/12/24
 */

public interface CourseDao {

    /**
     * 根据用户id列出该用户所有课程.
     * @param userId
     * @return
     * @throws IllegalArgumentException
     * @throws CourseNotFoundException
     */
    List<Course> listCourseByUserId(BigInteger userId)throws IllegalArgumentException,CourseNotFoundException;

    /**
     * 新增课程.
     * @param userId
     * @param course
     * @return
     * @throws IllegalArgumentException
     */
    BigInteger insertCourseByUserId(BigInteger userId, Course course)throws IllegalArgumentException;

    /**
     * 根据课程id获取该课程信息.
     * @param courseId
     * @return
     * @throws IllegalArgumentException
     * @throws CourseNotFoundException
     */
    Course getCourseByCourseId(BigInteger courseId)throws IllegalArgumentException,CourseNotFoundException;

    /**
     * 根据课程id更新课程信息.
     * @param courseId
     * @param course
     */
    void updateCourseByCourseId(BigInteger courseId, Course course);

    /**
     * 根据课程id删除课程.
     * @param courseId
     * @throws IllegalArgumentException
     */
    void deleteCourseByCourseId(BigInteger courseId)throws IllegalArgumentException;

    /**
     * 根据课程名称列出课程.
     * @param courseName
     * @return
     */
    List<Course> listCourseByCourseName(String courseName);

}
